#ifndef OVERLAYLIST_H
#define OVERLAYLIST_H


class TExpressionDict;
class TOvrExpression;
class TOvrCorner;

///////////////////////////////////////////////////////////
// TOverlayTreeWidget /////////////////////////////////////
///////////////////////////////////////////////////////////
//
class TOverlayTreeWidget : public QTreeWidget
{
	Q_OBJECT
public:
	TOverlayTreeWidget( TExpressionDict *eDict, QWidget *parent = NULL );
	//
	bool isActive(){ return active; }
	void setActive( bool active );
	//
	void setOvrCorner( TOvrCorner *cor);
 	void addExpression( TOvrExpression &expr );
//	QStringList getExprList();
	void fillFields();
	//
	void paintEvent(QPaintEvent* ev);
	
public slots:
	void removeCurrentExpression();

signals:
	void cornerDataChanged();
	void focusChanged( TOverlayTreeWidget *me, bool state );
	//
//	void needRepaint();

protected:
	virtual QMimeData* mimeData( const QList<QTreeWidgetItem*> items ) const;
	virtual bool dropMimeData( QTreeWidgetItem * parent, int index, const QMimeData * data, Qt::DropAction action );
	virtual void dropEvent(QDropEvent *event);
	//
	virtual void focusInEvent( QFocusEvent *event );

protected slots:
	void updateData();

private:
	void checkExprExistance(QTreeWidgetItem *item);
	void addItemFromExpr( const TOvrExpression &expr );
	//
	bool above;
	bool active;
	TOvrCorner *corner;
	TExpressionDict *exprDict;
};

#endif